:root {
    color-scheme: dark;
    --bg: #070b14;
    --sidebar: #0b1220;
    --card: #121a2b;
    --card-2: #162033;
    --text: #f4f7fb;
    --muted: #8b97ad;
    --line: rgba(148, 163, 184, 0.14);
    --teal: #2dd4bf;
    --teal-deep: #0f766e;
    --purple: #c084fc;
    --pink: #e879f9;
    --blue: #3b82f6;
    --gold: #fbbf24;
    --danger: #ef4444;
    --focus: #5eead4;
}

body.theme-light {
    color-scheme: light;
    --bg: #f3f6fb;
    --sidebar: #ffffff;
    --card: #ffffff;
    --card-2: #eaf0f7;
    --text: #172033;
    --muted: #64748b;
    --line: rgba(71, 85, 105, 0.18);
    --teal-deep: #0f766e;
    --focus: #0f766e;
}

* { box-sizing: border-box; }

[hidden] {
    display: none !important;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea, select {
    font: inherit;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.mark {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: block;
    object-fit: cover;
    box-shadow: 0 10px 28px rgba(88, 40, 160, 0.4);
}

.mark.small {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    box-shadow: none;
}

.login-view {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(900px 420px at 12% -8%, rgba(45, 212, 191, 0.12), transparent 55%),
        radial-gradient(800px 380px at 100% 0%, rgba(192, 132, 252, 0.12), transparent 50%),
        var(--bg);
}

.login-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 28px 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand .mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
}

.login-card h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

.lead, .empty, .muted {
    color: var(--muted);
}

.login-card form,
.login-card label {
    display: grid;
    gap: 6px;
}

.login-card form { gap: 14px; margin-top: 20px; }
.login-card label.login-remember { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.login-remember input { width: auto; margin: 0; }
.login-remember span { color: inherit; font-size: inherit; font-weight: 400; letter-spacing: normal; text-transform: none; }

label span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--purple);
}

input, textarea, select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(7, 11, 20, 0.72);
    color: var(--text);
    outline: none;
}

body.theme-light input, body.theme-light textarea, body.theme-light select {
    border-color: rgba(71, 85, 105, 0.2);
    background: rgba(255, 255, 255, 0.9);
}

.theme-toggle {
    position: fixed;
    top: 72px;
    right: 16px;
    z-index: 30;
    flex: 0 0 38px;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    box-shadow: none;
}

.theme-toggle:hover { color: var(--teal); background: transparent; }

input:focus, textarea:focus, select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.18);
}

.login-actions, .note-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

button {
    border: 0;
    border-radius: 12px;
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 700;
}

button[type="submit"], .primary {
    background: linear-gradient(135deg, #2dd4bf, #2563eb);
    color: #06201c;
}

button[type="button"] {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

button.danger {
    background: transparent;
    color: #fca5a5;
}

button:disabled { opacity: 0.6; cursor: wait; }

.icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-radius: 10px;
}

.danger-icon {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
}

.error, .banner {
    margin: 0;
    color: #ffb4ab;
    font-weight: 600;
}

.banner {
    margin: 0 24px 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
}

.app-view {
    --sidebar-width: 268px;
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 8px 1fr;
}

.app-view.is-resizing {
    cursor: col-resize;
    user-select: none;
}

.app-view.is-resizing * {
    cursor: col-resize !important;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    min-width: 0;
    overflow: auto;
    background: var(--sidebar);
    padding: 18px 14px 28px;
}

.sidebar-resizer {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 100vh;
    width: 8px;
    margin-left: -4px;
    cursor: col-resize;
    background: transparent;
    touch-action: none;
}

.sidebar-resizer::after {
    content: "";
    display: block;
    width: 2px;
    height: 100%;
    margin: 0 auto;
    background: var(--line);
    transition: background 0.15s ease, width 0.15s ease;
}

.sidebar-resizer:hover::after,
.sidebar-resizer:focus-visible::after,
.app-view.is-resizing .sidebar-resizer::after {
    width: 3px;
    background: var(--teal);
}

.sidebar-resizer:focus-visible {
    outline: none;
}

.app-view.is-compact .sidebar-brand > div {
    display: none;
}

.app-view.is-compact .sidebar-brand {
    justify-content: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
}

.sidebar-brand h1 {
    margin: 0;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.sidebar-brand p {
    margin: 2px 0 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.sidebar-nav {
    display: grid;
    gap: 18px;
}

.nav-section {
    display: grid;
    gap: 4px;
}

.nav-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-add {
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 7px;
    background: rgba(45, 212, 191, 0.12);
    color: var(--teal);
    font-size: 16px;
    line-height: 1;
}

.nav-item,
.nav-child {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: transparent;
    color: #d5deee;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 10px;
}

.nav-item:hover,
.nav-child:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.is-active,
.nav-child.is-active {
    background: rgba(45, 212, 191, 0.16);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.28);
}

.nav-item .count,
.nav-child .count,
.nav-site-head .count {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.nav-item.is-active .count,
.nav-child.is-active .count {
    color: var(--teal);
}

.nav-glyph {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    opacity: 0.85;
}

.nav-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-actions {
    display: flex;
    gap: 2px;
    margin-left: 4px;
}

.nav-actions button {
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
}

.folder-form {
    display: flex;
    gap: 6px;
    padding: 4px 6px 8px;
}

.folder-form input {
    padding: 7px 9px;
    border-radius: 9px;
}

.nav-folder {
    display: grid;
    gap: 2px;
}

.nav-folder-children {
    display: none;
    gap: 2px;
    padding: 0 0 4px 8px;
}

.nav-folder.is-open > .nav-folder-children {
    display: grid;
}

.nav-toggle {
    width: 18px;
    height: 18px;
    padding: 0;
    flex: 0 0 18px;
    display: grid;
    place-items: center;
    background: transparent;
    color: var(--muted);
    border-radius: 6px;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.nav-toggle.is-empty {
    visibility: hidden;
}

.nav-folder.is-open > .nav-item .chevron {
    transform: rotate(90deg);
}

.nav-site {
    display: grid;
    gap: 2px;
}

.nav-site-head {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    background: transparent;
    color: #d5deee;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 8px;
    text-align: left;
}

.nav-site-head:hover { background: rgba(255, 255, 255, 0.05); }
.nav-site-head.is-active {
    background: rgba(45, 212, 191, 0.16);
    color: #fff;
}

.chevron {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    opacity: 0.55;
    transition: transform 0.15s ease;
}

.nav-site.is-open .chevron {
    transform: rotate(90deg);
}

.nav-children {
    display: none;
    padding: 0 0 4px 18px;
    gap: 2px;
}

.nav-site.is-open .nav-children {
    display: grid;
}

.nav-child {
    font-size: 13px;
    font-weight: 500;
    color: #b7c3d8;
    padding: 6px 8px;
}

.workspace {
    min-width: 0;
    background:
        radial-gradient(900px 380px at 80% -10%, rgba(192, 132, 252, 0.08), transparent 50%),
        var(--bg);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px 24px;
    background: rgba(7, 11, 20, 0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}

body.theme-light .topbar {
    background: rgba(255, 255, 255, 0.92);
}

.page-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.page-heading-copy { display: none; }

.page-heading h2 {
    margin: 0;
    font-size: 18px;
}

.page-heading p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.menu-toggle { display: none; }

.search {
    max-width: 520px;
    justify-self: center;
    width: 100%;
    position: relative;
}

.tag-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 5;
    display: grid;
    gap: 2px;
    padding: 6px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.tag-suggest button {
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--teal);
    font-weight: 700;
}

.tag-suggest button:hover {
    background: rgba(45, 212, 191, 0.12);
}

.account {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: end;
}

.sort-control select {
    min-width: 132px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 650;
    border-radius: 8px;
}

button.sort-dir {
    width: 32px;
    height: 32px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

button.sort-dir.is-asc svg {
    transform: rotate(180deg);
}

button.sort-dir:hover,
button.sort-dir:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

.view-switch {
    display: flex;
    padding: 3px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
}

button.view-btn {
    width: 32px;
    height: 28px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
}

button.view-btn:hover,
button.view-btn:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

button.view-btn.is-active {
    background: rgba(45, 212, 191, 0.16);
    color: var(--teal);
}

.account-copy {
    display: grid;
    text-align: right;
}

.account-copy strong {
    font-size: 14px;
}

#account-email {
    color: var(--muted);
    font-size: 12px;
}

.notes {
    display: grid;
    gap: 8px;
    padding: 12px 16px 32px;
}

.notes.is-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.notes.is-list {
    grid-template-columns: repeat(auto-fill, minmax(64mm, 1fr));
    gap: 4px 8px;
}

.notes.is-list .note-card {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 2px;
    padding: 8px 76px 8px 12px;
}

.notes.is-list .note-card .body {
    -webkit-line-clamp: 1;
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.notes.is-list .note-card.is-editing {
    grid-template-columns: 1fr;
    align-items: stretch;
}

.note-card {
    position: relative;
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 10px 76px 10px 10px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: default;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.note-card[role="link"] {
    cursor: pointer;
}

.note-card:hover,
.note-card:focus-visible {
    border-color: rgba(45, 212, 191, 0.38);
    background: var(--card-2);
    outline: none;
}

.note-card.is-editing {
    cursor: default;
    padding: 10px;
    gap: 8px;
}

.note-card-tools {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
}

button.note-icon-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
}

button.note-icon-btn:hover,
button.note-icon-btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

button.note-icon-btn.view:hover,
button.note-icon-btn.view:focus-visible {
    background: rgba(45, 212, 191, 0.16);
    color: #99f6e4;
}

button.note-icon-btn.edit:hover,
button.note-icon-btn.edit:focus-visible {
    background: rgba(168, 85, 247, 0.16);
    color: #e9d5ff;
}

button.note-icon-btn.delete:hover,
button.note-icon-btn.delete:focus-visible {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
}

.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

button.note-tag {
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.12);
    color: #99f6e4;
    font-size: 10px;
    font-weight: 700;
}

.note-tags-input {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
}

.note-card .quote,
.note-card .body {
    margin: 0;
    overflow: hidden;
}

.note-card .quote {
    padding: 0;
    background: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.3;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.note-card .body {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
}

.note-card textarea {
    min-height: 72px;
    resize: vertical;
    font-size: 13px;
}

.note-card .folder-move {
    display: grid;
    gap: 6px;
}

.note-card .folder-move span {
    color: var(--muted);
}

.category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

button.category-tag {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(192, 132, 252, 0.16);
    color: #e9d5ff;
    font-size: 12px;
    font-weight: 700;
}

.category-actions {
    display: flex;
    gap: 6px;
}

.category-actions button {
    padding: 6px 10px;
    font-size: 12px;
}

.note-card:not(.is-editing) .note-actions {
    display: none;
}

.note-actions {
    gap: 6px;
}

.note-actions button {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 8, 16, 0.62);
}

.dialog {
    width: min(380px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.dialog.note-view {
    width: min(560px, 100%);
}

.note-view-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.note-view-head h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.note-view-quote,
.note-view-body,
.note-view-meta {
    margin: 0 0 12px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.note-view-quote {
    color: #99f6e4;
    font-size: 14px;
}

.note-view-body {
    font-size: 14px;
}

.note-view-meta {
    color: var(--muted);
    font-size: 12px;
    white-space: normal;
}

.note-view .note-tags {
    margin-bottom: 12px;
}

.note-tag {
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.12);
    color: #99f6e4;
    font-size: 10px;
    font-weight: 700;
}

.dialog p {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 650;
    line-height: 1.4;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

button.danger-solid {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
}

.empty {
    padding: 80px 24px;
    text-align: center;
}

.sidebar-backdrop {
    display: none;
}

button.new-note-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #2dd4bf, #2563eb);
    color: #06201c;
    font-size: 12px;
    white-space: nowrap;
}

.task-summary-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(45, 212, 191, 0.24);
    color: var(--teal);
    background: rgba(45, 212, 191, 0.1);
    font-size: 12px;
}

.note-card.is-daily {
    padding-left: 10px;
}

.note-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.16);
    color: #fbbf24;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.note-card.is-pinned {
    border-color: rgba(251, 191, 36, 0.35);
}

.note-card.is-dragging {
    opacity: 0.5;
}

.nav-item.is-drop {
    outline: 1px dashed var(--teal);
    background: rgba(45, 212, 191, 0.14);
}

button.note-icon-btn.pin.is-on,
button.note-icon-btn.pin:hover,
button.note-icon-btn.pin:focus-visible {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.14);
}

.daily-editor {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 8, 16, 0.62);
}

.daily-editor-panel {
    width: min(840px, 100%);
    height: min(780px, calc(100vh - 48px));
    display: grid;
    grid-template-rows: auto auto 1fr;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

/* Keep the editing surfaces usable on compact screens. */
.daily-editor-panel,
.dialog,
.md-editor {
    min-width: 0;
}

.daily-editor-top {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto auto auto;
    gap: 8px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

#daily-folder {
    max-width: 160px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 650;
}

#daily-title {
    border: 0;
    background: transparent;
    padding: 6px 4px;
    font-size: 20px;
    font-weight: 700;
}

.daily-edited {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

#daily-pin.is-on {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.14);
}

.daily-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.daily-toolbar button,
.daily-toolbar select,
.daily-color {
    border: 0;
    border-radius: 8px;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    display: inline-grid;
    place-items: center;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.daily-toolbar button:hover,
.daily-toolbar select:hover,
.daily-color:hover,
.daily-toolbar button.is-active {
    background: rgba(45, 212, 191, 0.16);
    color: var(--teal);
}

.tb-sep {
    width: 1px;
    height: 18px;
    margin: 0 4px;
    background: var(--line);
}

.tb-more-wrap {
    position: relative;
}

.tb-more-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 6;
    display: grid;
    gap: 4px;
    min-width: 160px;
    padding: 8px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.tb-more-menu button {
    justify-content: start;
    height: auto;
    padding: 6px 8px;
}

#daily-format-toggle.is-collapsed svg {
    transform: rotate(-90deg);
}

.daily-toolbar select {
    padding: 5px 6px;
}

.daily-color {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.daily-color input {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
}

.daily-body {
    min-height: 0;
    overflow: auto;
    padding: 20px 24px 32px;
    outline: none;
    font-size: 16px;
    line-height: 1.6;
}

.daily-body:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.daily-body h1 { font-size: 28px; margin: 0 0 12px; }
.daily-body h2 { font-size: 22px; margin: 0 0 10px; }
.daily-body h3 { font-size: 18px; margin: 0 0 8px; }
.daily-body ul,
.daily-body ol { margin: 0 0 12px; padding-left: 22px; }
.daily-body a { color: var(--teal); }
.daily-body .daily-check {
    list-style: none;
    padding-left: 4px;
}
.daily-body .daily-check li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.note-preview {
    max-height: 2.7em;
    overflow: hidden;
    pointer-events: none;
    font-size: 12px;
    line-height: 1.35;
    color: var(--muted);
}

.note-preview * {
    display: inline;
    margin: 0;
    padding: 0;
    font-size: inherit;
    font-weight: inherit;
}

.pin-mark {
    font-size: 11px;
}

.note-view-html {
    margin: 0 0 12px;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.55;
}

.note-menu {
    position: fixed;
    z-index: 60;
    min-width: 220px;
    padding: 6px;
    border-radius: 12px;
    background: #121a2b;
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

body.theme-light button.sort-dir {
    background: var(--card);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.note-menu button {
    width: 100%;
    display: block;
    text-align: left;
    background: transparent;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 600;
}

.note-menu button:hover,
.note-menu button:focus-visible {
    background: rgba(45, 212, 191, 0.12);
    color: var(--text);
    outline: none;
}

.note-menu button.is-danger {
    color: #fca5a5;
}

.note-menu button.is-danger:hover,
.note-menu button.is-danger:focus-visible {
    background: rgba(239, 68, 68, 0.14);
}

.note-menu-sep {
    height: 1px;
    margin: 5px 6px;
    background: var(--line);
}

.note-menu-sub {
    position: relative;
}

.note-menu-flyout {
    display: none;
    position: absolute;
    left: calc(100% + 4px);
    top: 0;
    min-width: 180px;
    max-height: 240px;
    overflow: auto;
    padding: 6px;
    border-radius: 12px;
    background: #121a2b;
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.note-menu-sub:hover .note-menu-flyout,
.note-menu-sub:focus-within .note-menu-flyout {
    display: grid;
}

@media (max-width: 980px) {
    .app-view {
        grid-template-columns: 1fr;
    }
    .sidebar-resizer {
        display: none;
    }
    .menu-toggle { display: grid; }
    .topbar {
        grid-template-columns: auto 1fr auto;
    }
    .search {
        grid-column: 1 / -1;
        max-width: none;
        justify-self: stretch;
    }
    .sidebar {
        position: fixed;
        z-index: 20;
        left: 0;
        top: 0;
        width: min(300px, 88vw);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }
    .sidebar.is-open {
        transform: none;
    }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 15;
        background: rgba(0, 0, 0, 0.45);
    }
}

@media (max-width: 640px) {
    html,
    body {
        min-width: 0;
        overflow-x: hidden;
    }

    .topbar {
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        padding: 6px;
    }

    .menu-toggle { order: 0; width: 32px; height: 32px; }
    .page-heading { order: 1; flex: 0 0 auto; gap: 3px; }
    .search { order: 2; flex: 1 1 auto; min-width: 36px; max-width: none; }

    .page-heading {
        flex: 0 0 auto;
        min-width: 0;
        gap: 3px;
    }

    button.new-note-btn {
        flex: 0 0 auto;
        width: 32px;
        height: 32px;
    }

    .task-summary-chip {
        display: inline-flex;
        flex: 0 0 auto;
        width: 32px;
        height: 32px;
    }

    .tasks-head { height: 0; min-height: 0; margin: 0; padding: 0 0 0 92px; }
    .tasks-head > div:first-child,
    #tasks-summary { display: none; }
    .tasks-head-actions {
        position: absolute;
        top: 16px;
        right: 10px;
        width: auto;
        flex-wrap: nowrap;
    }
    .task-head-icon { width: 38px; height: 38px; }

    .account {
        display: contents;
    }

    .account .sort-control,
    .account .view-switch,
    .account-copy { display: none; }

    .sort-dir { order: 3; width: 32px; height: 32px; padding: 0; flex: 0 0 32px; }
    .topbar-task-actions { order: 4; display: flex; align-items: center; gap: 3px; flex: 0 0 auto; }
    .task-head-icon { width: 32px; height: 32px; }
    #sign-out { order: 5; width: 32px; height: 32px; padding: 0; flex: 0 0 32px; }

    .sort-control {
        flex: 1 1 auto;
        min-width: 0;
    }

    .sort-control select {
        min-width: 0;
    }

    .notes {
        padding: 8px 10px 28px;
        gap: 8px;
    }

    .notes.is-grid,
    .notes.is-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .notes.is-list .note-card,
    .note-card {
        min-width: 0;
        padding-right: 86px;
    }

    .note-card.is-editing,
    .notes.is-list .note-card.is-editing {
        padding: 10px;
    }

    .note-card-tools {
        top: 7px;
        right: 7px;
        gap: 4px;
    }

    button.note-icon-btn {
        width: 32px;
        height: 32px;
    }

    .dialog-backdrop {
        align-items: end;
        padding: 10px;
    }

    .dialog,
    .dialog.note-view {
        width: 100%;
        max-height: calc(100dvh - 20px);
        overflow: auto;
        border-radius: 16px 16px 10px 10px;
        padding: 16px;
    }

    .dialog-actions {
        position: sticky;
        bottom: -16px;
        margin: 0 -16px -16px;
        padding: 12px 16px;
        background: var(--card);
        border-top: 1px solid var(--line);
    }

    .daily-editor {
        align-items: stretch;
        padding: 0;
    }

    .daily-editor-panel {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .daily-editor-top {
        grid-template-columns: auto minmax(0, 1fr) auto auto auto;
        gap: 6px;
        padding: 8px;
    }

    #daily-title {
        min-width: 0;
        font-size: 18px;
    }

    #daily-folder {
        grid-column: 1 / 4;
        width: 100%;
        max-width: none;
    }

    .daily-edited {
        grid-column: 4 / 6;
        min-width: 0;
        overflow: hidden;
        text-align: right;
        text-overflow: ellipsis;
    }

    .daily-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding: 7px 8px;
        scrollbar-width: thin;
    }

    .daily-toolbar > * {
        flex: 0 0 auto;
    }

    .daily-body {
        padding: 16px 14px 32px;
        font-size: 16px;
    }

    .daily-body h1 { font-size: 25px; }
    .daily-body h2 { font-size: 21px; }
    .daily-body h3 { font-size: 18px; }

    .md-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 9px 10px;
    }

    .md-bar-text {
        flex: 1 1 150px;
        min-width: 0;
    }

    .md-bar-actions {
        width: 100%;
        min-width: 0;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .md-seg,
    .md-bar-actions > button {
        flex: 0 0 auto;
    }

    .md-preview {
        padding: 22px 16px;
    }

    .md-source {
        padding: 20px 16px;
        font-size: 13px;
    }
}

/* Local Markdown file editor */

.md-editor {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.md-editor[hidden] {
    display: none !important;
}

.md-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--card);
}

.md-bar-text {
    min-width: 0;
}

.md-bar-text h3 {
    margin: 0;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-path {
    margin: 2px 0 0;
    font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.md-seg {
    display: inline-flex;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.md-seg-btn {
    border: 0;
    border-radius: 8px;
    padding: 5px 11px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.md-seg-btn.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.md-state {
    min-width: 120px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

.md-state[data-tone="busy"] {
    color: #ffd60a;
}

.md-state[data-tone="error"] {
    color: #ff6b63;
}

.md-panes {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1px;
    min-height: 0;
    background: var(--line);
}

.md-panes[data-layout="view"],
.md-panes[data-layout="edit"] {
    grid-template-columns: minmax(0, 1fr);
}

.md-panes[data-layout="view"] .md-pane-edit,
.md-panes[data-layout="edit"] .md-preview {
    display: none;
}

.md-pane {
    min-width: 0;
    min-height: 0;
    background: var(--card);
    overflow: auto;
}

.md-preview {
    padding: 32px 36px;
    line-height: 1.65;
}

.md-pane-edit {
    display: flex;
    overflow: hidden;
}

.md-source {
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 28px 30px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
    resize: none;
    outline: none;
    tab-size: 4;
}

@media (max-width: 760px) {
    .md-panes {
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: minmax(0, 1fr);
    }

    .md-state {
        display: none;
    }
}

.markdown-body > *:first-child {
    margin-top: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin: 1.6em 0 0.6em;
    line-height: 1.3;
    font-weight: 700;
}

.markdown-body h1 { font-size: 1.8em; }
.markdown-body h2 { font-size: 1.45em; }
.markdown-body h3 { font-size: 1.2em; }

.markdown-body h1,
.markdown-body h2 {
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--line);
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre,
.markdown-body blockquote,
.markdown-body table {
    margin: 0 0 1em;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 1.6em;
}

.markdown-body ul.md-tasks {
    list-style: none;
    padding-left: 0.2em;
}

.markdown-body ul.md-tasks input {
    margin-right: 6px;
}

.markdown-body code {
    padding: 0.15em 0.35em;
    border-radius: 5px;
    background: rgba(148, 163, 184, 0.16);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9em;
}

.markdown-body pre {
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.14);
    overflow: auto;
}

.markdown-body pre code {
    padding: 0;
    background: transparent;
}

.markdown-body blockquote {
    padding: 2px 0 2px 16px;
    border-left: 4px solid var(--line);
    color: var(--muted);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.markdown-body th,
.markdown-body td {
    padding: 7px 10px;
    border: 1px solid var(--line);
    text-align: left;
}

.markdown-body th {
    background: rgba(148, 163, 184, 0.14);
    font-weight: 700;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 10px;
}

.markdown-body hr {
    height: 1px;
    margin: 1.8em 0;
    border: 0;
    background: var(--line);
}

/* Daily tasks */
.eyebrow {
    margin: 0 0 3px;
    color: var(--teal);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tasks-view {
    position: relative;
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 24px 48px;
}

.tasks-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.tasks-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.task-head-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
}

.topbar-task-actions { display: none; }

.topbar-task-actions #theme-toggle { display: none; }

.task-notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 1px 4px;
    border: 2px solid var(--card);
    border-radius: 999px;
    color: #fff;
    background: #ef4444;
    font-size: 10px;
    font-weight: 800;
    line-height: 13px;
    text-align: center;
}

.tasks-head h2 {
    margin: 0;
    font-size: 26px;
}

.tasks-head p:last-child {
    margin: 3px 0 0;
}

.task-quick-add {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    margin-bottom: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.task-title-field {
    flex: 1 1 auto;
    min-width: 180px;
}

.task-quick-add input,
.task-quick-add select {
    min-width: 0;
    padding: 9px 10px;
    border-radius: 9px;
}

.task-quick-add input[type="date"] { width: 142px; }
.task-quick-add input[type="time"] { width: 110px; }
.task-quick-add select { width: 112px; }
.task-quick-assignee-email { width: 170px; }

.task-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.task-notifications-panel {
    display: grid;
    gap: 4px;
    max-width: 560px;
    margin: -6px 0 14px auto;
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.25);
}

.task-notification {
    width: 100%;
    padding: 8px 10px;
    text-align: left;
    color: var(--text);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
}

.task-notification:hover { background: rgba(45, 212, 191, 0.12); }
.task-notification.is-read { color: var(--muted); font-weight: 500; }

.task-filter {
    padding: 7px 10px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    font-size: 12px;
}

.task-filter.is-active {
    color: var(--teal);
    background: rgba(45, 212, 191, 0.14);
}

.task-archive-filter { display: inline-flex; align-items: center; gap: 5px; }

.task-search {
    flex: 1 1 220px;
    margin-left: auto;
}

.task-search input { padding: 8px 10px; }

.task-groups {
    display: grid;
    gap: 22px;
}

.task-load-more {
    display: block;
    margin: 18px auto 0;
    color: var(--teal);
    background: rgba(45, 212, 191, 0.12);
}

.task-group-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}

.task-group-heading h3 {
    margin: 0;
    font-size: 14px;
}

.task-group-heading span {
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.07);
    font-size: 11px;
    text-align: center;
}

.task-list {
    display: grid;
    gap: 5px;
}

.task-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 11px;
}

.task-row:hover { background: var(--card-2); border-color: rgba(45, 212, 191, 0.3); }
.task-row.is-dragging { opacity: 0.45; }

.task-check {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    color: var(--muted);
    background: transparent;
    font-size: 18px;
}

.task-row-completed .task-check { color: #22c55e; border-color: #22c55e; }
.task-row-content { min-width: 0; cursor: pointer; }
.task-row-content h3 { margin: 0; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.task-row-content h3.is-done { color: var(--muted); text-decoration: line-through; }

.task-row-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.task-badge,
.task-priority,
.task-due,
.task-person {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    white-space: nowrap;
}

.task-badge { background: rgba(107, 114, 128, 0.16); color: #d1d5db; }
.state-in_progress { color: #93c5fd; background: rgba(59, 130, 246, 0.16); }
.state-blocked { color: #fca5a5; background: rgba(239, 68, 68, 0.16); }
.state-waiting { color: #fcd34d; background: rgba(245, 158, 11, 0.16); }
.state-in_review { color: #c4b5fd; background: rgba(139, 92, 246, 0.18); }
.state-completed { color: #86efac; background: rgba(34, 197, 94, 0.16); }
.state-cancelled { color: #cbd5e1; background: rgba(100, 116, 139, 0.18); }
.priority-high, .task-priority-high { color: #fca5a5; background: rgba(239, 68, 68, 0.16); }
.priority-normal, .task-priority-normal { color: #86efac; background: rgba(34, 197, 94, 0.16); }
.priority-low, .task-priority-low { color: #cbd5e1; background: rgba(148, 163, 184, 0.1); }
.task-state-in_progress { color: #93c5fd; background: rgba(59, 130, 246, 0.16); }
.task-state-in_review { color: #c4b5fd; background: rgba(139, 92, 246, 0.18); }
.task-state-completed { color: #86efac; background: rgba(34, 197, 94, 0.16); }
.task-due.is-overdue { color: #fca5a5; background: rgba(239, 68, 68, 0.12); }
.task-person { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }

.task-row-actions { display: flex; align-items: center; gap: 6px; }
.task-select { width: 16px; height: 16px; margin: 0; }
.task-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-group-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-select-all { display: inline-flex !important; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }
.task-select-all input { width: 15px; height: 15px; margin: 0; }
.task-delete { padding: 5px 8px; font-size: 11px; }
.task-group-completed .task-row { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.task-group-completed .task-row:not(.can-delete) { grid-template-columns: auto minmax(0, 1fr) auto; }
.task-group-completed .task-row-actions { flex-wrap: nowrap; min-width: 0; }
.task-group-completed .task-state { min-width: 88px; }
.task-group-completed .task-priority-select { min-width: 72px; }
.task-state { width: auto; min-width: 112px; padding: 6px 8px; border-radius: 8px; font-size: 11px; }
.task-priority-select { width: auto; min-width: 82px; padding: 6px 8px; border-radius: 8px; font-size: 11px; }
.task-more { padding: 6px 9px; font-size: 11px; }
.task-reorder { display: none; padding: 4px 7px; font-size: 13px; }

.task-detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 8, 16, 0.68);
}

.task-detail {
    width: min(720px, 100%);
    max-height: min(820px, calc(100vh - 48px));
    overflow: auto;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.task-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.task-detail-head-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.task-detail-head-actions .icon-btn { width: 34px; height: 34px; }
.task-detail-head-actions .icon-btn.is-active { color: var(--accent); background: rgba(45, 212, 191, 0.14); }
.task-detail-head h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.task-detail-view { display: grid; gap: 16px; }
.task-view-description { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.03); }
.task-view-description p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-view-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.task-view-grid > div { display: grid; gap: 4px; min-width: 0; padding: 10px 12px; border-radius: 9px; background: rgba(255,255,255,0.03); }
.task-view-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.task-view-grid strong { overflow-wrap: anywhere; }
.task-view-info { display: grid; gap: 16px; }
.task-view-info summary { cursor: pointer; color: var(--teal); font-weight: 700; }
.task-edit-info { display: grid; gap: 12px; margin-top: 4px; }
.task-edit-info summary { cursor: pointer; color: var(--teal); font-weight: 700; }
.task-detail-form { display: grid; gap: 12px; }
.task-detail-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.task-detail-form label.task-checkbox-field { display: flex; align-items: center; gap: 7px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 9px; }
.task-checkbox-field input { width: auto; }
.task-detail-form textarea { resize: vertical; min-height: 100px; }
.task-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.task-responsibility-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.task-detail-responsibility { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.task-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.task-comments, .task-history { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.task-comments h3 { margin: 0 0 8px; font-size: 14px; }
.task-comment-list { display: grid; gap: 7px; }
.task-comment { padding: 8px 10px; background: rgba(255, 255, 255, 0.04); border-radius: 9px; }
.task-comment-head { display: flex; align-items: center; gap: 8px; }
.task-comment strong { font-size: 12px; }
.task-comment time { margin-left: 8px; color: var(--muted); font-size: 10px; }
.task-comment p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-comment-edit { margin-left: auto; padding: 2px 7px; font-size: 11px; }
.task-comment-edit-form { display: grid; gap: 7px; margin-top: 7px; }
.task-comment-edit-form textarea { min-height: 48px; resize: vertical; }
.task-comment-edit-form button { justify-self: start; }
.task-comment-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.task-comment-form textarea { min-height: 48px; resize: vertical; }
.task-collaborators { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.task-collaborators h3 { margin: 0 0 8px; font-size: 14px; }
.task-collaborator-form { display: flex; align-items: center; gap: 8px; }
.task-collaborator-form input[type="email"] { flex: 1; min-width: 0; }
.task-collaborator-form label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.task-collaborator-form label input { width: auto; }
.task-collaborator-list { display: grid; gap: 5px; margin-top: 8px; }
.task-collaborator-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.04); color: var(--muted); font-size: 12px; }
.task-collaborator-remove { padding: 4px 7px; font-size: 10px; }
.task-history summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 700; }
.task-history-list { display: grid; gap: 4px; margin-top: 10px; }
.task-history-list p { margin: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }

@media (max-width: 640px) {
    .tasks-view { padding: 0 10px 32px; }
    .tasks-head h2 { font-size: 22px; }
    .tasks-head-actions { width: 100%; }
    .tasks-head-actions button { flex: 1 1 auto; min-height: 40px; }
    .task-quick-add { align-items: stretch; flex-wrap: wrap; }
    .task-title-field { flex-basis: 100%; }
    .task-quick-add input[type="date"], .task-quick-add input[type="time"], .task-quick-add select { flex: 1 1 0; width: auto; }
    .task-quick-assignee-email { flex: 1 1 100%; width: auto; }
    .task-quick-add button { flex: 1 1 100%; min-height: 42px; }
    .task-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
    .task-filter { flex: 0 0 auto; min-height: 40px; }
    .task-search { flex: 1 0 100%; order: 5; }
    .task-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; padding: 10px; }
    .task-row-actions { grid-column: 2; width: 100%; }
    .task-state { flex: 1; width: 100%; min-height: 38px; }
    .task-priority-select { flex: 1; width: 100%; min-height: 38px; }
    .task-more { min-height: 38px; }
    .task-reorder { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 38px; }
    .task-row-meta { gap: 4px; }
    .task-person { max-width: 145px; }
    .task-group-completed .task-row { grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; padding: 7px; gap: 6px; }
    .task-group-completed .task-row:not(.can-delete) { grid-template-columns: auto minmax(0, 1fr) auto; }
    .task-group-completed .task-row-actions { grid-column: auto; width: auto; gap: 4px; }
    .task-group-completed .task-check { width: 28px; height: 28px; font-size: 16px; }
    .task-group-completed .task-state { min-width: 78px; padding: 5px 6px; }
    .task-group-completed .task-priority-select { min-width: 66px; padding: 5px 6px; }
    .task-group-completed .task-delete { padding: 5px 6px; }
    .task-group-heading { flex-wrap: nowrap; }
    .task-group-actions { flex-wrap: nowrap; gap: 4px; min-width: 0; }
    .task-group-actions button { padding: 4px 6px; font-size: 10px; white-space: nowrap; }
    .task-detail-backdrop { align-items: start; padding: 0; }
    .task-detail { width: 100%; max-height: 94dvh; border-radius: 0 0 18px 18px; padding: 16px; }
    .task-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .task-responsibility-grid { grid-template-columns: minmax(0, 1fr); }
    .task-comment-form { grid-template-columns: 1fr; }
    .task-comment-form button { min-height: 42px; }
    .task-collaborator-form { align-items: stretch; flex-wrap: wrap; }
    .task-collaborator-form input[type="email"] { flex-basis: 100%; }
    .task-collaborator-form button { min-height: 40px; }
}

@media (max-width: 640px) {
    .topbar-task-actions { display: flex; }
}
