/* --- NOTES & TOOLS --- */
.agent-tools-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.agent-tools-modal {
    margin: 0;
}

.notes-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.notes-subtab {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(11,20,39,0.8);
    color: #cfe0ff;
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
}

.notes-subtab.active {
    background: linear-gradient(135deg, rgba(76,110,187,0.85), rgba(44,74,130,0.85));
    border-color: rgba(110,160,255,0.5);
    color: #f4f7ff;
    box-shadow: 0 10px 22px rgba(15,36,80,0.35);
}

.notes-subpanel {
    display: none;
}

.notes-subpanel.active {
    display: block;
}

.note-compose .agent-notes-input {
    min-height: 180px;
}

.note-history .agent-note-list {
    max-height: 360px;
}

@media (max-width: 820px) {
    .note-history .agent-note-list {
        max-height: 260px;
    }
}

.notes-tabs {
    display: flex;
    gap: 8px;
    padding: 6px 2px 10px;
}

.notes-tab {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(11,20,39,0.8);
    color: #cfe0ff;
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
}

.notes-tab.active {
    background: linear-gradient(135deg, rgba(76,110,187,0.85), rgba(44,74,130,0.85));
    border-color: rgba(110,160,255,0.5);
    color: #f4f7ff;
    box-shadow: 0 10px 22px rgba(15,36,80,0.35);
}

.notes-panel {
    display: none;
}

.notes-panel.active {
    display: block;
}

.agent-tools-panel.flash {
    animation: panel-flash 0.8s ease;
}

@keyframes panel-flash {
    0% { box-shadow: 0 0 0 rgba(0,0,0,0); }
    40% { box-shadow: 0 0 0 3px rgba(59,130,246,0.25); }
    100% { box-shadow: 0 0 0 rgba(0,0,0,0); }
}
.agent-tool-card {
    background: var(--gradient-card);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 24px;
    color: var(--color-text);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.5), 
                inset 0 1px 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 260px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.agent-tool-card:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 16px 32px rgba(6,14,28,0.4);
}

.agent-tool-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.agent-tool-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    flex: 0 0 44px;
    transition: all 0.3s ease;
}
.agent-tool-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.agent-tool-icon svg rect,
.agent-tool-icon svg path {
    fill: currentColor;
}

.agent-tool-icon svg path[stroke] {
    fill: none;
    stroke: currentColor;
}

.agent-tool-title {
    font-weight: 700;
    font-size: 14px;
}

.agent-tool-sub {
    font-size: 12px;
    color: #b7c8ea;
    margin-top: 2px;
}

.agent-notes-input {
    min-height: 100px;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid var(--color-primary);
    background: var(--color-input-bg);
    color: var(--color-text);
    font-size: 13px;
    padding: 10px 12px;
    box-shadow: inset 0 1px 6px rgba(0,0,0,0.35);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.agent-notes-input:focus {
    border-color: rgba(110,160,255,0.7);
    box-shadow: inset 0 1px 6px rgba(0,0,0,0.35), 0 0 0 2px rgba(80,120,220,0.25);
    outline: none;
}

.agent-tool-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
}

.agent-tool-hint {
    font-size: 11px;
    color: #9fb2da;
}

.agent-note-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 240px;
    overflow: auto;
    padding-right: 6px;
}

.agent-check-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow: auto;
    margin: 0;
    padding-right: 6px;
}

.agent-note-item {
    position: relative;
    background: linear-gradient(135deg, rgba(16,28,52,0.92), rgba(10,18,34,0.92));
    border: 1px solid rgba(120,170,255,0.2);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 20px rgba(4,10,20,0.4);
    overflow: hidden;
    min-height: 110px;
    height: 110px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

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

.agent-note-date {
    font-size: 11px;
    color: #a7bddf;
}

.agent-note-del,
.agent-check-del {
    background: rgba(148,27,27,0.2);
    border: 1px solid rgba(239,68,68,0.6);
    color: #fecaca;
    border-radius: 8px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.agent-note-del:hover,
.agent-check-del:hover {
    background: rgba(148,27,27,0.3);
}

.agent-note-text {
    font-size: 12px;
    color: var(--color-text);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    cursor: pointer;
    flex: 1 1 auto;
}

.agent-note-item:hover {
    border-color: rgba(110,160,255,0.5);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 14px 26px rgba(4,10,20,0.45);
    transform: translateY(-2px);
}

.agent-note-empty,
.agent-check-empty {
    font-size: 12px;
    color: #9fb2da;
    padding: 8px 4px;
    text-align: center;
}

.agent-check-input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(10,18,34,0.45);
    border: 1px solid rgba(110,160,255,0.12);
}

.agent-check-input input {
    flex: 1 1 auto;
    border-radius: 10px;
    border: 1px solid var(--color-primary);
    background: var(--color-input-bg);
    color: var(--color-text);
    font-size: 13px;
    padding: 8px 12px;
    height: 36px;
    box-shadow: inset 0 1px 6px rgba(0,0,0,0.35);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.agent-check-input input:focus {
    border-color: rgba(110,160,255,0.7);
    box-shadow: inset 0 1px 6px rgba(0,0,0,0.35), 0 0 0 2px rgba(80,120,220,0.25);
    outline: none;
}

.agent-check-item {
    margin: 0;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 12px;
    display: flex;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(12,20,38,0.6);
    transition: all 0.2s ease;
}

.agent-check-item:hover {
    background: rgba(16,26,48,0.7);
}

.agent-check-item.is-checked .agent-check-text {
    text-decoration: line-through;
    color: #9fb2da;
    opacity: 0.7;
}

.agent-check-text {
    font-size: 13px;
    color: var(--color-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.agent-check-meta {
    font-size: 10px;
    color: #c8d6f0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(120,170,255,0.2);
    background: rgba(12,20,38,0.6);
    margin-left: auto;
}

.agent-check-item .agent-check-del {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Modal styles */
#modal-backdrop-notes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5,10,18,0.45);
    display: none;
    z-index: 1000;
    overflow-y: auto;
    padding: 24px 0 32px;
}

#modal-backdrop-notes.show {
    display: block;
}

#modal-backdrop-notes .modal {
    max-width: 1250px;
    width: 96%;
    margin: 0 auto;
    height: auto;
    min-height: 0;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-card);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(4,10,20,0.5);
    border: 1px solid rgba(120,170,255,0.2);
}

#modal-backdrop-notes .modal-scroll {
    max-height: calc(85vh - 180px);
    height: auto;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px;
}

#modal-backdrop-notes .agent-check-list {
    max-height: none;
    overflow: visible;
}

#modal-backdrop-notes .agent-note-list {
    max-height: none;
    overflow: visible;
}

#modal-backdrop-note-detail .modal {
    width: 96%;
    max-width: 1200px;
    height: 86vh;
    margin: 40px auto;
    display: flex;
    flex-direction: column;
    background: var(--color-card);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(4,10,20,0.5);
    border: 1px solid rgba(120,170,255,0.2);
}

#modal-backdrop-note-detail .modal-scroll {
    flex: 1 1 auto;
    max-height: none;
    padding: 20px;
}

.note-detail-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 6px 0 10px;
}

.note-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 4px 0 10px;
}

.note-tool-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--color-secondary);
    background: rgba(14,24,46,0.8);
    color: var(--color-text);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-tool-btn:hover {
    background: rgba(20,36,66,0.9);
}

.note-tool-select {
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--color-secondary);
    background: rgba(14,24,46,0.8);
    color: var(--color-text);
    font-size: 12px;
    padding: 0 8px;
}

.note-color-palette {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border-radius: 10px;
    border: 1px solid var(--color-secondary);
    background: rgba(14,24,46,0.8);
}

.note-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.35);
    cursor: pointer;
    padding: 0;
    background: #ffffff;
    transition: all 0.2s ease;
}

.note-color-swatch:hover {
    transform: scale(1.1);
}

.note-color-swatch.active {
    box-shadow: 0 0 0 2px rgba(110,160,255,0.6);
}

.note-detail-editor {
    width: 100%;
    min-height: 260px;
    height: 100%;
    border-radius: 12px;
    border: 1px solid var(--color-primary);
    background: var(--color-input-bg);
    color: var(--color-text);
    font-size: 14px;
    padding: 14px;
    box-shadow: inset 0 1px 6px rgba(0,0,0,0.35);
    outline: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.note-detail-editor:focus {
    border-color: rgba(110,160,255,0.7);
    box-shadow: inset 0 1px 6px rgba(0,0,0,0.35), 0 0 0 2px rgba(80,120,220,0.25);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    #modal-backdrop-notes .modal {
        width: 96%;
        margin: 30px auto;
    }
}

@media (max-width: 720px) {
    #modal-backdrop-notes .modal {
        width: 96%;
        margin: 16px auto;
    }
    
    #modal-backdrop-notes.fullscreen .modal {
        width: 98%;
        height: 90vh;
    }
    
    .agent-tools-panel {
        grid-template-columns: 1fr;
    }
    
    .agent-tool-card {
        min-height: auto;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(10,18,34,0.4);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(76,110,187,0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(76,110,187,0.7);
}