/* ==========================================================
   Notepad — beautiful personal app
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

:root {
    --bg-0: #0a0814;
    --bg-1: #120e22;
    --bg-2: #1a1433;

    --surface:    rgba(255, 255, 255, 0.035);
    --surface-2:  rgba(255, 255, 255, 0.06);
    --surface-3:  rgba(255, 255, 255, 0.10);
    --border:     rgba(255, 255, 255, 0.08);
    --border-2:   rgba(255, 255, 255, 0.14);

    --text:       #ece9f7;
    --text-dim:   #9c98b8;
    --text-mute:  #6a6783;

    --accent:     #a855f7;
    --accent-2:   #ec4899;
    --accent-3:   #6366f1;
    --grad:       linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    --grad-soft:  linear-gradient(135deg, rgba(168,85,247,.18), rgba(236,72,153,.18));

    --ok:         #10b981;
    --warn:       #f59e0b;
    --danger:     #ef4444;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 24px;

    --shadow-1: 0 6px 24px -8px rgba(0,0,0,.6);
    --shadow-2: 0 18px 50px -12px rgba(0,0,0,.7);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, "Noto Sans", sans-serif,
            "Apple Color Emoji","Segoe UI Emoji";

    --topbar-h: 64px;
    --bottom-h: 64px;
}

html { color-scheme: dark; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg-0);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;          /* у каждого view свой скролл */
    overscroll-behavior: none;
}

button { font-family: inherit; }
input, textarea, select, button { font-family: inherit; color: inherit; }

::selection { background: rgba(168,85,247,.35); color: #fff; }

/* атрибут hidden должен побеждать любой display из классов */
[hidden] { display: none !important; }

/* фоновое свечение */
.bg, .auth-bg {
    position: fixed; inset: 0; z-index: -1; overflow: hidden;
    background:
        radial-gradient(900px 500px at 12% -10%, rgba(168,85,247,.18), transparent 60%),
        radial-gradient(800px 600px at 110% 110%, rgba(236,72,153,.15), transparent 55%),
        radial-gradient(700px 700px at 50% 50%, rgba(99,102,241,.08), transparent 70%),
        linear-gradient(180deg, var(--bg-1), var(--bg-0));
}

/* плотный шум поверх (опционально, через svg-data-uri) */
.bg::after, .auth-bg::after {
    content: ""; position: absolute; inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    opacity: .35; mix-blend-mode: overlay; pointer-events: none;
}

/* ==========================================================
   AUTH (login / setup)
   ========================================================== */
.auth-body {
    display: grid; place-items: center;
    min-height: 100vh;
    padding: 24px;
}
.auth-card {
    width: min(420px, 100%);
    background: var(--surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 36px 32px 32px;
    box-shadow: var(--shadow-2);
    text-align: center;
    animation: pop .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
.auth-logo {
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    border-radius: 18px;
    display: grid; place-items: center;
    background: var(--grad);
    color: #fff;
    box-shadow: 0 12px 40px -10px rgba(168,85,247,.6);
}
.auth-card h1 {
    margin: 0 0 6px; font-size: 24px; letter-spacing: -.01em;
}
.auth-sub { margin: 0 0 22px; color: var(--text-dim); font-size: 14px; }
.auth-error {
    background: rgba(239,68,68,.12);
    color: #fda4a4;
    border: 1px solid rgba(239,68,68,.3);
    padding: 10px 12px;
    border-radius: var(--r-md);
    margin-bottom: 14px;
    font-size: 13px;
}
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.field input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 14px;
    border-radius: var(--r-md);
    font-size: 15px;
    outline: none;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input:focus {
    border-color: rgba(168,85,247,.5);
    background: var(--surface-3);
    box-shadow: 0 0 0 4px rgba(168,85,247,.12);
}
.auth-hint { font-size: 12px; color: var(--text-mute); margin: -2px 2px 4px; }

.btn-primary {
    margin-top: 6px;
    background: var(--grad);
    color: #fff;
    border: 0;
    padding: 12px 18px;
    border-radius: var(--r-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 30px -12px rgba(168,85,247,.6);
    transition: transform .12s, box-shadow .15s, filter .15s;
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

/* ==========================================================
   TOPBAR
   ========================================================== */
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
    background: rgba(10,8,20,.65);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 26px; height: 26px; border-radius: 8px;
    background: var(--grad);
    box-shadow: 0 8px 20px -6px rgba(236,72,153,.5);
}
.brand-name {
    font-weight: 700; letter-spacing: -.01em;
    background: var(--grad);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tabs { display: flex; gap: 4px; justify-self: center; }
.tab {
    display: inline-flex; align-items: center; gap: 8px;
    background: transparent; border: 1px solid transparent;
    color: var(--text-dim);
    padding: 9px 14px; border-radius: 999px;
    font-size: 14px; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border-2);
}
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn {
    width: 38px; height: 38px;
    display: inline-grid; place-items: center;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s, transform .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { color: #fca5a5; border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.08); }
.icon-btn.active { background: var(--grad-soft); color: #fff; border-color: rgba(168,85,247,.3); }

/* ==========================================================
   APP layout
   ========================================================== */
.app {
    height: calc(100vh - var(--topbar-h));
    height: calc(100dvh - var(--topbar-h));
    position: relative;
    overflow: hidden;
}
.view {
    position: absolute; inset: 0;
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
.view.active { opacity: 1; pointer-events: auto; }

.empty-state {
    display: grid; place-items: center; gap: 12px;
    height: 100%;
    color: var(--text-mute);
    text-align: center;
}
.empty-state svg { opacity: .5; }
.hidden { display: none !important; }

/* ==========================================================
   NOTES
   ========================================================== */
.view-notes {
    display: grid;
    grid-template-columns: 320px 1fr;
}
.notes-sidebar {
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
    min-height: 0;
}
.sidebar-head {
    display: flex; gap: 8px; align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}
.search {
    flex: 1;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
}
.search input {
    flex: 1; background: transparent; border: 0; outline: none;
    color: var(--text); font-size: 14px; min-width: 0;
}
.search:focus-within {
    border-color: rgba(168,85,247,.4);
    box-shadow: 0 0 0 4px rgba(168,85,247,.1);
}
.btn-new {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--grad);
    border: 0; color: #fff;
    display: grid; place-items: center;
    cursor: pointer;
    box-shadow: 0 10px 25px -10px rgba(236,72,153,.5);
    transition: transform .12s, filter .15s;
}
.btn-new:hover { filter: brightness(1.1); transform: translateY(-1px); }

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
}
.note-item {
    position: relative;
    padding: 12px 14px 12px 18px;
    margin-bottom: 6px;
    border-radius: var(--r-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s, transform .12s;
}
.note-item::before {
    content: "";
    position: absolute; left: 6px; top: 14px; bottom: 14px;
    width: 3px; border-radius: 3px;
    background: var(--accent);
}
.note-item:hover { background: var(--surface); }
.note-item.active {
    background: var(--surface-2);
    border-color: var(--border-2);
}
.note-item .ni-title {
    font-weight: 600; font-size: 14px;
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 4px;
    color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-item .ni-pin { color: var(--accent-2); flex-shrink: 0; }
.note-item .ni-snippet {
    font-size: 12px; color: var(--text-mute);
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.note-item .ni-meta {
    display: flex; gap: 6px; align-items: center;
    margin-top: 6px;
    font-size: 11px; color: var(--text-mute);
}
.note-item .ni-tag {
    background: var(--surface-2);
    padding: 1px 8px; border-radius: 999px;
}

.notes-editor {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.editor-wrap {
    display: flex; flex-direction: column;
    height: 100%;
    padding: 22px 28px;
    gap: 14px;
    overflow: hidden;
}
.editor-head {
    display: flex; align-items: center; gap: 10px;
}
.editor-title {
    flex: 1;
    font-size: 26px; font-weight: 700;
    background: transparent; border: 0; outline: none;
    color: var(--text);
    letter-spacing: -.01em;
    min-width: 0;
}
.editor-tools { display: flex; gap: 4px; align-items: center; }
.color-picker {
    display: inline-flex; gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border-radius: 999px;
    border: 1px solid var(--border);
}
.color-dot {
    width: 22px; height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .12s, border-color .12s;
}
.color-dot:hover { transform: scale(1.12); }
.color-dot.active { border-color: #fff; }

.tags-row {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; font-size: 12px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; color: var(--text-dim);
}
.tag .x { cursor: pointer; opacity: .6; }
.tag .x:hover { opacity: 1; color: var(--danger); }
.tag-input {
    background: transparent; border: 0; outline: none;
    color: var(--text); font-size: 13px; min-width: 90px;
    padding: 4px 6px;
}
.editor-content {
    flex: 1;
    background: transparent; border: 0; outline: none;
    color: var(--text);
    font-size: 15px; line-height: 1.6;
    resize: none;
    font-family: var(--font);
    min-height: 200px;
}
.editor-meta { font-size: 12px; color: var(--text-mute); }

.back-btn { display: none; }

/* ==========================================================
   TODOS
   ========================================================== */
.view-todos { overflow-y: auto; padding: 24px 18px 90px; }
.todos-wrap {
    max-width: 760px;
    margin: 0 auto;
}
.todo-add {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 8px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-1);
}
.todo-add input {
    background: transparent; border: 0; outline: none;
    color: var(--text);
    padding: 10px 12px;
    font-size: 15px;
    min-width: 0;
}
.todo-add select {
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--r-md);
    padding: 9px 10px; font-size: 13px; outline: none;
}
.todo-add .btn-primary { padding: 10px 16px; font-size: 14px; }

.todo-filters {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 14px;
}
.chip {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 7px 14px; border-radius: 999px;
    font-size: 13px; cursor: pointer;
    display: inline-flex; gap: 8px; align-items: center;
    transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { background: var(--surface); color: var(--text); }
.chip.active {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border-2);
}
.chip span {
    background: var(--surface-2);
    padding: 0 8px; border-radius: 999px;
    font-size: 11px; color: var(--text-dim);
}
.chip.danger:hover {
    color: #fca5a5; border-color: rgba(239,68,68,.3);
    background: rgba(239,68,68,.08);
}
.ml-auto { margin-left: auto; }

.todo-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.todo {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: background .15s, border-color .15s, transform .12s;
}
.todo:hover { background: var(--surface-2); }
.todo.done { opacity: .55; }
.todo.done .todo-text { text-decoration: line-through; color: var(--text-dim); }
.todo .check {
    width: 22px; height: 22px;
    border: 2px solid var(--border-2);
    border-radius: 7px;
    display: grid; place-items: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.todo.done .check { background: var(--grad); border-color: transparent; }
.todo.done .check svg { display: block; }
.todo .check svg { display: none; color: #fff; }

.priority-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.priority-dot.high   { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.priority-dot.medium { background: var(--warn);   box-shadow: 0 0 8px var(--warn); }
.priority-dot.low    { background: var(--ok);     box-shadow: 0 0 8px var(--ok); }

.todo-text {
    background: transparent; border: 0; outline: none;
    color: var(--text); font-size: 14.5px;
    min-width: 0;
    padding: 4px 0;
}
.todo-del {
    width: 30px; height: 30px;
    border-radius: 8px; background: transparent; border: 0;
    color: var(--text-mute); cursor: pointer;
    display: grid; place-items: center;
    opacity: 0; transition: opacity .15s, color .15s, background .15s;
}
.todo:hover .todo-del { opacity: 1; }
.todo-del:hover { color: var(--danger); background: rgba(239,68,68,.08); }

/* ==========================================================
   BOARDS / KANBAN
   ========================================================== */
.view-boards { display: flex; flex-direction: column; min-height: 0; }
.boards-bar {
    display: flex; gap: 6px; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: thin;
    flex-shrink: 0;
}
.board-tab {
    display: inline-flex; align-items: center; gap: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    padding: 8px 14px; border-radius: 999px;
    font-size: 14px; cursor: pointer; white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
}
.board-tab:hover { color: var(--text); background: var(--surface); }
.board-tab.active {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border-2);
}
.board-tab .ico { font-size: 16px; }
.board-add {
    margin-left: 4px;
    width: 34px; height: 34px;
    border: 1px dashed var(--border-2);
    border-radius: 999px; background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    display: grid; place-items: center;
    flex-shrink: 0;
    transition: color .15s, border-color .15s, background .15s;
}
.board-add:hover { color: var(--text); border-color: rgba(168,85,247,.5); background: var(--surface); }

.board-canvas {
    flex: 1; min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 18px;
    scroll-snap-type: x mandatory;
}
.board-empty {
    display: grid; place-items: center;
    height: 100%;
    color: var(--text-mute);
    text-align: center;
}
.board-grid {
    display: flex; gap: 16px;
    height: 100%;
    min-height: 0;
    align-items: flex-start;
}
.board-head {
    flex-shrink: 0; flex-basis: 100%;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
    /* this row is positioned above columns; replaced by per-column layout */
}
.column {
    flex: 0 0 320px;
    max-height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    display: flex; flex-direction: column;
    transition: border-color .15s, background .15s;
    scroll-snap-align: start;
}
.column.drop-target {
    border-color: rgba(168,85,247,.55);
    background: rgba(168,85,247,.06);
    box-shadow: 0 0 0 4px rgba(168,85,247,.10);
}
.col-head {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.col-name {
    flex: 1;
    background: transparent; border: 0; outline: none;
    color: var(--text); font-weight: 600; font-size: 14px;
    padding: 2px 4px;
    border-radius: 6px;
    min-width: 0;
}
.col-name:focus { background: var(--surface-2); }
.col-count {
    font-size: 11px; color: var(--text-mute);
    background: var(--surface-2);
    padding: 1px 8px; border-radius: 999px;
}
.col-menu {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: transparent; border: 0;
    color: var(--text-mute); cursor: pointer;
    display: grid; place-items: center;
    transition: background .15s, color .15s;
}
.col-menu:hover { background: var(--surface-2); color: var(--text); }

.cards {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex; flex-direction: column; gap: 8px;
    scrollbar-width: thin;
    min-height: 60px;
}
.card {
    position: relative;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: grab;
    transition: border-color .15s, background .15s, transform .12s, box-shadow .15s;
    user-select: none;
    touch-action: none;       /* нужно для pointer-DnD на мобилках */
}
.card::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;
    background: var(--accent);
}
.card:hover {
    background: var(--surface-3);
    border-color: var(--border-2);
}
.card.drag-source { opacity: .35; }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.35; word-break: break-word; }
.card-url {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 6px;
    font-size: 12px; color: var(--text-dim);
    text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.card-url:hover { color: var(--accent-2); }
.card-url img { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }
.card-note { margin-top: 6px; font-size: 12px; color: var(--text-mute); white-space: pre-wrap; }
.card-actions {
    margin-top: 8px;
    display: flex; gap: 4px;
    opacity: 0;
    transition: opacity .15s;
}
.card:hover .card-actions, .card.touched .card-actions { opacity: 1; }
.card-action {
    background: transparent; border: 0;
    width: 24px; height: 24px; border-radius: 6px;
    display: grid; place-items: center;
    color: var(--text-mute); cursor: pointer;
    transition: background .15s, color .15s;
}
.card-action:hover { background: var(--surface-3); color: var(--text); }
.card-action.danger:hover { color: var(--danger); background: rgba(239,68,68,.08); }

.dragging-ghost {
    position: fixed !important;
    z-index: 1000;
    pointer-events: none;
    cursor: grabbing;
    transform: rotate(1.5deg) scale(1.02);
    box-shadow: 0 24px 50px -10px rgba(0,0,0,.7);
    opacity: .96;
    background: var(--bg-2);
}

.add-card {
    margin: 0 10px 10px;
    width: calc(100% - 20px);
    background: transparent;
    border: 1px dashed var(--border-2);
    color: var(--text-dim);
    padding: 9px;
    border-radius: var(--r-md);
    font-size: 13px;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}
.add-card:hover { color: var(--text); border-color: rgba(168,85,247,.5); background: var(--surface); }

.add-column {
    flex: 0 0 320px;
    align-self: flex-start;
    background: transparent;
    border: 1px dashed var(--border-2);
    border-radius: var(--r-lg);
    color: var(--text-dim);
    padding: 14px;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.add-column:hover { color: var(--text); border-color: rgba(168,85,247,.5); background: var(--surface); }

/* ==========================================================
   MODAL
   ========================================================== */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(8,6,16,.65);
    backdrop-filter: blur(4px);
    display: grid; place-items: center;
    padding: 20px;
    animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    width: min(440px, 100%);
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    animation: pop .2s cubic-bezier(.2,.8,.2,1);
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.modal-body label { font-size: 12px; color: var(--text-dim); display: flex; flex-direction: column; gap: 4px; }
.modal-body input,
.modal-body textarea,
.modal-body select {
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); font-size: 14px;
    padding: 10px 12px; border-radius: var(--r-md);
    outline: none;
}
.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    border-color: rgba(168,85,247,.5);
    box-shadow: 0 0 0 4px rgba(168,85,247,.12);
}
.modal-body textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
}
.btn-ghost {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 9px 14px; border-radius: var(--r-md);
    font-size: 14px; cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-danger {
    background: rgba(239,68,68,.12);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,.3);
    padding: 9px 14px; border-radius: var(--r-md);
    font-size: 14px; cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-danger:hover { background: rgba(239,68,68,.2); color: #fff; }

.modal-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    margin-top: 6px;
}
.modal-emoji {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px; cursor: pointer;
    font-size: 18px; line-height: 1; text-align: center;
    transition: background .15s, border-color .15s, transform .12s;
}
.modal-emoji:hover { background: var(--surface-3); }
.modal-emoji.active { border-color: rgba(168,85,247,.6); background: var(--grad-soft); }

/* ==========================================================
   TOASTS
   ========================================================== */
.toast-host {
    position: fixed; right: 16px; bottom: 80px; z-index: 100;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--bg-2);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-size: 13px;
    box-shadow: var(--shadow-1);
    pointer-events: auto;
    animation: toast-in .2s cubic-bezier(.2,.8,.2,1);
}
.toast.error { border-color: rgba(239,68,68,.4); color: #fda4a4; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ==========================================================
   BOTTOM NAV (mobile)
   ========================================================== */
.bottom-nav {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: var(--bottom-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(10,8,20,.85);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
}
.bn {
    flex: 1;
    background: transparent; border: 0;
    color: var(--text-mute);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    cursor: pointer;
    font-size: 11px;
    transition: color .15s;
}
.bn.active { color: var(--accent-2); }

/* ==========================================================
   SCROLLBAR
   ========================================================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); background-clip: content-box; }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 880px) {
    .topbar .tabs { display: none; }
    .topbar { grid-template-columns: 1fr auto; }
    .bottom-nav { display: flex; }
    .app {
        height: calc(100vh - var(--topbar-h) - var(--bottom-h));
        height: calc(100dvh - var(--topbar-h) - var(--bottom-h));
    }
    .toast-host { bottom: calc(var(--bottom-h) + 16px); }

    .view-notes { grid-template-columns: 1fr; }
    .notes-sidebar { border-right: 0; }
    .notes-editor { display: none; }
    .view-notes.editor-open .notes-sidebar { display: none; }
    .view-notes.editor-open .notes-editor { display: flex; }
    .back-btn { display: inline-grid; }
    .editor-wrap { padding: 16px; }
    .editor-title { font-size: 22px; }

    .todo-add { grid-template-columns: 1fr auto; }
    .todo-add input { grid-column: 1 / -1; }

    .column { flex-basis: 86vw; max-width: 360px; }
    .add-column { flex-basis: 86vw; max-width: 360px; }
    .board-canvas { padding: 14px; }
}

@media (max-width: 420px) {
    .topbar { padding: 0 14px; }
    .brand-name { font-size: 14px; }
    .editor-tools .icon-btn { width: 34px; height: 34px; }
}
