.ctl-wrap {
    background: linear-gradient(135deg, rgba(255, 239, 107, 0.35), rgba(178, 255, 241, 0.45));
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

.ctl-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.ctl-topbar .ctl-search {
    margin-bottom: 0;
    flex: 1 1 auto;
}

.ctl-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 14px;
}

.ctl-sidebar,
.ctl-main {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 12px;
}

.ctl-main {
    min-width: 0;
    overflow-x: hidden;
}

.ctl-sidebar-title {
    font-weight: 700;
    margin-bottom: 10px;
}

.ctl-search {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 10px;
}

.ctl-cards {
    display: grid;
    gap: 8px;
}

.ctl-card-item {
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 10px;
    font-weight: 600;
    cursor: pointer;
}

.ctl-card-item.is-active {
    background: #ecfdf5;
    border-color: #22c55e;
}

.ctl-card-item--snippet {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.ctl-card-item--snippet.is-active {
    background: #dbeafe;
    border-color: #60a5fa;
}

.ctl-card-item--note {
    background: #fff7ed;
    border-color: #fed7aa;
}

.ctl-card-item--note.is-active {
    background: #ffedd5;
    border-color: #fb923c;
}

.ctl-card-item.is-dragging {
    opacity: 0.6;
}

.ctl-btn {
    border: 1px solid #111827;
    background: #fff;
    color: #111827;
    border-radius: 9px;
    padding: 6px 11px;
    font-weight: 700;
    font-size: 0.85rem;
}

.ctl-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #111827;
}

.ctl-btn-primary {
    background: #d1fae5;
}

.ctl-btn-note {
    background: #ffedd5;
}

.ctl-btn-danger {
    background: #fecaca;
}

.ctl-btn-copy {
    background: #cffafe;
}

.ctl-actions-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 8px;
}

.ctl-welcome,
.ctl-empty,
.ctl-deny {
    color: #4b5563;
}

.ctl-editor {
    display: grid;
    gap: 8px;
}

.ctl-editor-title-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.ctl-btn-attach {
    min-width: 40px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    font-size: 1rem;
}

.ctl-editor-files {
    margin-bottom: 2px;
}

.ctl-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ctl-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(0, 0, 0, 0.13);
    border-radius: 999px;
    background: #f8fafc;
    padding: 4px 8px;
    font-size: 0.78rem;
}

.ctl-file-chip a {
    text-decoration: none;
    color: #0f172a;
}

.ctl-file-remove {
    border: 0;
    background: transparent;
    color: #b91c1c;
    font-weight: 700;
    line-height: 1;
    padding: 0 2px;
}

.ctl-files-empty {
    font-size: 0.8rem;
}

.ctl-editor input,
.ctl-task-block input {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
}

.ctl-note-input {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    line-height: 1.45;
}

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

.ctl-task-block {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    background: #f9fafb;
    padding: 10px;
    display: grid;
    gap: 6px;
}

.ctl-task-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: end;
}

.ctl-task-row input {
    font-size: 0.9rem;
    padding: 7px 9px;
}

.ctl-code-editor {
    margin: 0;
    min-height: 140px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 10px 12px;
    overflow: auto;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.84rem;
    line-height: 1.45;
    white-space: pre;
}

.ctl-code-editor:focus {
    outline: 2px solid #22c55e;
    outline-offset: 1px;
}

.ctl-task-head {
    font-weight: 700;
    color: #374151;
}

.ctl-card-view h3 {
    margin: 0;
}

.ctl-description {
    margin: 0 0 10px;
    color: #4b5563;
}

.ctl-view-task {
    border: 1px dashed rgba(0, 0, 0, 0.18);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.ctl-note-view {
    border: 1px dashed rgba(0, 0, 0, 0.18);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.ctl-note-text {
    white-space: pre-wrap;
    line-height: 1.28;
}

.ctl-note-text h1,
.ctl-note-text h2,
.ctl-note-text h3 {
    margin: 0.2em 0 0.15em;
    line-height: 1.18;
}

.ctl-note-text ul,
.ctl-note-text ol {
    margin: 0.18em 0 0.28em 1.05em;
    padding-left: 0.65em;
}

.ctl-note-text p {
    margin: 0.15em 0;
}

.ctl-note-text li {
    margin: 0.08em 0;
    line-height: 1.26;
}

.ctl-note-text > :first-child {
    margin-top: 0 !important;
}

.ctl-note-text > :last-child {
    margin-bottom: 0 !important;
}

.ctl-card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ctl-files-inline {
    display: inline-flex;
    align-items: flex-end;
    gap: 6px;
    font-size: 0.78rem;
    color: #374151;
    justify-content: flex-end;
}

.ctl-files-inline-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}

.ctl-files-inline a {
    text-decoration: none;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ctl-file-link-clip {
    font-size: 0.78rem;
    opacity: 0.85;
}

.ctl-files-inline a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.ctl-view-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.05em;
    margin-top: 0;
    min-width: 110px;
}

.ctl-view-value {
    white-space: pre-wrap;
    margin-top: 0;
    line-height: 1.35;
    align-self: center;
}

.ctl-view-row--desc .ctl-view-value {
    color: #111827;
    font-weight: 600;
}

.ctl-view-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 5px;
}

.ctl-view-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ctl-view-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.ctl-view-desc-text {
    color: #111827;
    font-weight: 600;
    line-height: 1.35;
}

.ctl-where-code {
    display: inline-block;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #111827;
    border-radius: 6px;
    padding: 3px 7px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
}

.ctl-view-task .ctl-btn-copy {
    margin-top: 8px;
}

.ctl-view-task pre {
    margin: 8px 0;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 10px 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(30 * 1.45em + 20px);
    overflow: auto;
    box-sizing: border-box;
}

.ctl-view-code {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.ctl-view-task code,
.ctl-code-lines code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.84rem;
}

.ctl-code-lines {
    margin: 0;
    padding: 0 0 0 42px;
    counter-reset: line;
    width: max-content;
    min-width: 100%;
}

.ctl-code-lines li {
    list-style: decimal-leading-zero;
    padding: 0 12px 0 4px;
    line-height: 1.45;
    white-space: pre;
}

@media (max-width: 900px) {
    .ctl-layout {
        grid-template-columns: 1fr;
    }

    .ctl-task-row {
        grid-template-columns: 1fr;
    }

    .ctl-view-row {
        grid-template-columns: 1fr;
    }

    .ctl-view-inline {
        grid-template-columns: 1fr;
    }

    .ctl-view-meta {
        align-items: flex-start;
    }

    .ctl-card-title-row {
        align-items: flex-start;
        flex-direction: column;
    }
}
