/* Shared CRUD list UI — AiPortal SchemaGrid + patient portal (portal.html) */

/* Form fields — shared by portal screens + AiPortal inline CRUD forms */
.fld {
    margin-bottom: 14px;
}
.fld label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}
.fld input,
.fld select,
.fld textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: #1a2744;
    background: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}
.fld input:focus,
.fld select:focus,
.fld textarea:focus {
    border-color: #1a2744;
}
.fld textarea {
    min-height: 72px;
    resize: vertical;
}
.fld-hint {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 3px;
}
.row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.row3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

/* CRUD list container — AiPortal SchemaGrid + portal history sections */
.medico-crud-list .fld {
    margin-bottom: 14px;
}

.medico-crud-list .btn-ai {
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
}

/* AI assist banner */
.medico-crud-list .ai-banner {
    background: #f5f3ff;
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.medico-crud-list .ai-banner-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.medico-crud-list .ai-banner-text {
    flex: 1;
    font-size: 11px;
    color: #5b21b6;
    line-height: 1.4;
}
.medico-crud-list .ai-banner-text strong {
    font-weight: 700;
}

/* Entry cards */
.medico-crud-list .entry-card {
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 11px 13px;
    margin-bottom: 8px;
    background: #fff;
    display: grid;
    grid-template-columns: 8px 1fr auto;
    align-items: start;
    gap: 8px;
    transition: border-color 0.15s;
}
.medico-crud-list .entry-card.entry-card--plan-copy {
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem 0.65rem;
    align-items: start;
}
.medico-crud-list .entry-card.entry-card--plan-copy .entry-plan-copy {
    padding-top: 0.15rem;
}
.medico-crud-list .entry-card:hover {
    border-color: #bfdbfe;
}
.medico-crud-list .entry-ai-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7c3aed;
    flex-shrink: 0;
    margin-top: 4px;
}
.medico-crud-list .entry-spacer {
    width: 8px;
    flex-shrink: 0;
}
.medico-crud-list .entry-body {
    flex: 1;
    min-width: 0;
}
.medico-crud-list .entry-name {
    font-size: 13px;
    font-weight: 700;
    color: #1a2744;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.medico-crud-list .entry-bullet {
    color: #1a2744;
    margin-right: 4px;
    font-weight: 700;
}
.medico-crud-list .entry-status-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 7.5rem;
    flex-shrink: 0;
}
.medico-crud-list .entry-status-select {
    width: 100%;
    max-width: 11rem;
    font-size: 0.75rem;
}
.medico-crud-list .entry-meta {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.45;
    word-break: break-word;
}
.medico-crud-list .entry-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}
.medico-crud-list .badge-active {
    background: #dcfce7;
    color: #15803d;
}
.medico-crud-list .badge-managed {
    background: #dbeafe;
    color: #1e40af;
}
.medico-crud-list .badge-resolved {
    background: #f3f4f6;
    color: #6b7280;
}
.medico-crud-list .entry-btns {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    flex-shrink: 0;
}
.medico-crud-list .entry-btns .entry-status-select {
    min-width: 7.5rem;
    max-width: 11rem;
    width: auto;
    font-size: 0.75rem;
}
.medico-crud-list .btn-edit-sm {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.medico-crud-list .btn-del-sm {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.medico-crud-list .ai-tag {
    font-size: 9px;
    background: #ede9fe;
    color: #6d28d9;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    margin-top: 3px;
    display: inline-block;
}

/* Inline add/edit form */
.medico-crud-list .inline-form {
    border: 1.5px dashed #93c5fd;
    border-radius: 10px;
    padding: 14px;
    background: #f0f9ff;
    margin-bottom: 10px;
}
.medico-crud-list .inline-form-title {
    font-size: 12px;
    font-weight: 700;
    color: #1a2744;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.medico-crud-list .inline-form-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.medico-crud-list .btn-save-sm {
    background: #1a2744;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.medico-crud-list .btn-cancel-sm {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.medico-crud-list .btn-add-entry {
    width: 100%;
    border: 1.5px dashed #bfdbfe;
    background: #fff;
    color: #1d4ed8;
    border-radius: 10px;
    padding: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    font-family: inherit;
}
.medico-crud-list .btn-add-entry:hover {
    background: #eff6ff;
}

/* Empty state */
.medico-crud-list .crud-empty {
    border: 1px dashed #bdbdbd;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    color: #757575;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 0.75rem;
    background: #fafafa;
}

/* Chat helper (AiPortal) */
.medico-crud-list .schema-chat-helper {
    border: 1px solid #c4b5fd;
    background: #faf5ff;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 12px;
}
.medico-crud-list .schema-chat-prompt {
    font-size: 11px;
    font-weight: 600;
    color: #5b21b6;
    margin-bottom: 0.5rem;
}
.medico-crud-list .schema-chat-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.medico-crud-list .schema-chat-input-row input {
    flex: 1;
    padding: 7px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
}
.medico-crud-list .schema-chat-btn {
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}
.medico-crud-list .schema-chat-btn:disabled {
    opacity: 0.6;
    cursor: default;
}
.medico-crud-list .schema-chat-response {
    margin-top: 0.6rem;
    background: #ede9fe;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 11px;
    color: #5b21b6;
    line-height: 1.5;
}
